<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js</title>
</head>
<style>
	img{
		cursor: pointer;
		position: absolute;
		top:0px;
		left:0px;
	}
</style>
<body>
	<img src="a.jpg" alt="" id="imgid" style="width:400px; height:300px;" >
</body>

<script>
//document是显示在浏览器区域的整个页面<html></html>

imgobj=document.getElementById('imgid');
//鼠标每动一下有一个坐标
document.onmousemove=function(event){ //event获取当时发生的坐标
	x=event.clientX;
	y=event.clientY;
	document.title=x+'-'+y;//鼠标移动，更改浏览器的标题

	imgobj.style.left=x+'px';
	imgobj.style.top=y+'px';
}

</script>
</html>